<template>
   <div class="student">
        <h2>学生{{name}}</h2>
        <h2>年龄{{age}}</h2>
        <button @click="sendStudentName">把学生名给App</button>
        <button @click="unbind">解绑事件</button>
    </div>    
</template>

<script>
     export default({
        name:'Student',
        props:['getStudentName'],
        data() {
            return {
                name:'weiwei',
                age:22
            }
        },
        methods:{         
            sendStudentName(){
                // $emit(监听的事件,参数)
                this.$emit('weiwei',this.name,666,888,900)
                this.$emit('demo')
            },
            unbind(){
                this.$off(['weiwei','demo'])
            }
        }
    })
   
</script>

<style>
    .student{
        background-color: skyblue;
    }
</style>